import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class Solution187 {
    public List<String> findRepeatedDnaSequences(String s) {
        HashSet<String> list = new HashSet<>();
        if (s.length() <= 10) {
            return new ArrayList<>(list);
        }
        HashSet<String> set = new HashSet<>();
        char[] chars = s.toCharArray();
        for (int i = 0; i <= chars.length - 10; i++) {
            String sub = String.valueOf(chars, i, 10);
            if (!set.add(sub)) {
                list.add(sub);
            }
        }
        return new ArrayList<>(list);
    }
}
